\(\int (-a+b \cot (c+d x)) (a+b \cot (c+d x))^{3/2} \, dx\) [99]

   Optimal result
   Rubi [A] (verified)
   Mathematica [C] (verified)
   Maple [B] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [F]
   Giac [F]
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 27, antiderivative size = 408 \[ \int (-a+b \cot (c+d x)) (a+b \cot (c+d x))^{3/2} \, dx=\frac {b \left (a^2+b^2\right ) \text {arctanh}\left (\frac {\sqrt {a+\sqrt {a^2+b^2}}-\sqrt {2} \sqrt {a+b \cot (c+d x)}}{\sqrt {a-\sqrt {a^2+b^2}}}\right )}{\sqrt {2} \sqrt {a-\sqrt {a^2+b^2}} d}-\frac {b \left (a^2+b^2\right ) \text {arctanh}\left (\frac {\sqrt {a+\sqrt {a^2+b^2}}+\sqrt {2} \sqrt {a+b \cot (c+d x)}}{\sqrt {a-\sqrt {a^2+b^2}}}\right )}{\sqrt {2} \sqrt {a-\sqrt {a^2+b^2}} d}-\frac {2 b (a+b \cot (c+d x))^{3/2}}{3 d}+\frac {b \left (a^2+b^2\right ) \log \left (a+\sqrt {a^2+b^2}+b \cot (c+d x)-\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} \sqrt {a+b \cot (c+d x)}\right )}{2 \sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} d}-\frac {b \left (a^2+b^2\right ) \log \left (a+\sqrt {a^2+b^2}+b \cot (c+d x)+\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} \sqrt {a+b \cot (c+d x)}\right )}{2 \sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} d} \]

[Out]

-2/3*b*(a+b*cot(d*x+c))^(3/2)/d+1/2*b*(a^2+b^2)*arctanh((-2^(1/2)*(a+b*cot(d*x+c))^(1/2)+(a+(a^2+b^2)^(1/2))^(
1/2))/(a-(a^2+b^2)^(1/2))^(1/2))/d*2^(1/2)/(a-(a^2+b^2)^(1/2))^(1/2)-1/2*b*(a^2+b^2)*arctanh((2^(1/2)*(a+b*cot
(d*x+c))^(1/2)+(a+(a^2+b^2)^(1/2))^(1/2))/(a-(a^2+b^2)^(1/2))^(1/2))/d*2^(1/2)/(a-(a^2+b^2)^(1/2))^(1/2)+1/4*b
*(a^2+b^2)*ln(a+b*cot(d*x+c)+(a^2+b^2)^(1/2)-2^(1/2)*(a+b*cot(d*x+c))^(1/2)*(a+(a^2+b^2)^(1/2))^(1/2))/d*2^(1/
2)/(a+(a^2+b^2)^(1/2))^(1/2)-1/4*b*(a^2+b^2)*ln(a+b*cot(d*x+c)+(a^2+b^2)^(1/2)+2^(1/2)*(a+b*cot(d*x+c))^(1/2)*
(a+(a^2+b^2)^(1/2))^(1/2))/d*2^(1/2)/(a+(a^2+b^2)^(1/2))^(1/2)

Rubi [A] (verified)

Time = 0.61 (sec) , antiderivative size = 408, normalized size of antiderivative = 1.00, number of steps used = 13, number of rules used = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {3609, 12, 3566, 714, 1143, 648, 632, 212, 642} \[ \int (-a+b \cot (c+d x)) (a+b \cot (c+d x))^{3/2} \, dx=\frac {b \left (a^2+b^2\right ) \text {arctanh}\left (\frac {\sqrt {\sqrt {a^2+b^2}+a}-\sqrt {2} \sqrt {a+b \cot (c+d x)}}{\sqrt {a-\sqrt {a^2+b^2}}}\right )}{\sqrt {2} d \sqrt {a-\sqrt {a^2+b^2}}}-\frac {b \left (a^2+b^2\right ) \text {arctanh}\left (\frac {\sqrt {\sqrt {a^2+b^2}+a}+\sqrt {2} \sqrt {a+b \cot (c+d x)}}{\sqrt {a-\sqrt {a^2+b^2}}}\right )}{\sqrt {2} d \sqrt {a-\sqrt {a^2+b^2}}}+\frac {b \left (a^2+b^2\right ) \log \left (-\sqrt {2} \sqrt {\sqrt {a^2+b^2}+a} \sqrt {a+b \cot (c+d x)}+\sqrt {a^2+b^2}+a+b \cot (c+d x)\right )}{2 \sqrt {2} d \sqrt {\sqrt {a^2+b^2}+a}}-\frac {b \left (a^2+b^2\right ) \log \left (\sqrt {2} \sqrt {\sqrt {a^2+b^2}+a} \sqrt {a+b \cot (c+d x)}+\sqrt {a^2+b^2}+a+b \cot (c+d x)\right )}{2 \sqrt {2} d \sqrt {\sqrt {a^2+b^2}+a}}-\frac {2 b (a+b \cot (c+d x))^{3/2}}{3 d} \]

[In]

Int[(-a + b*Cot[c + d*x])*(a + b*Cot[c + d*x])^(3/2),x]

[Out]

(b*(a^2 + b^2)*ArcTanh[(Sqrt[a + Sqrt[a^2 + b^2]] - Sqrt[2]*Sqrt[a + b*Cot[c + d*x]])/Sqrt[a - Sqrt[a^2 + b^2]
]])/(Sqrt[2]*Sqrt[a - Sqrt[a^2 + b^2]]*d) - (b*(a^2 + b^2)*ArcTanh[(Sqrt[a + Sqrt[a^2 + b^2]] + Sqrt[2]*Sqrt[a
 + b*Cot[c + d*x]])/Sqrt[a - Sqrt[a^2 + b^2]]])/(Sqrt[2]*Sqrt[a - Sqrt[a^2 + b^2]]*d) - (2*b*(a + b*Cot[c + d*
x])^(3/2))/(3*d) + (b*(a^2 + b^2)*Log[a + Sqrt[a^2 + b^2] + b*Cot[c + d*x] - Sqrt[2]*Sqrt[a + Sqrt[a^2 + b^2]]
*Sqrt[a + b*Cot[c + d*x]]])/(2*Sqrt[2]*Sqrt[a + Sqrt[a^2 + b^2]]*d) - (b*(a^2 + b^2)*Log[a + Sqrt[a^2 + b^2] +
 b*Cot[c + d*x] + Sqrt[2]*Sqrt[a + Sqrt[a^2 + b^2]]*Sqrt[a + b*Cot[c + d*x]]])/(2*Sqrt[2]*Sqrt[a + Sqrt[a^2 +
b^2]]*d)

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 632

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 642

Int[((d_) + (e_.)*(x_))/((a_.) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Simp[d*(Log[RemoveContent[a + b*x +
c*x^2, x]]/b), x] /; FreeQ[{a, b, c, d, e}, x] && EqQ[2*c*d - b*e, 0]

Rule 648

Int[((d_.) + (e_.)*(x_))/((a_) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Dist[(2*c*d - b*e)/(2*c), Int[1/(a +
 b*x + c*x^2), x], x] + Dist[e/(2*c), Int[(b + 2*c*x)/(a + b*x + c*x^2), x], x] /; FreeQ[{a, b, c, d, e}, x] &
& NeQ[2*c*d - b*e, 0] && NeQ[b^2 - 4*a*c, 0] &&  !NiceSqrtQ[b^2 - 4*a*c]

Rule 714

Int[Sqrt[(d_) + (e_.)*(x_)]/((a_) + (c_.)*(x_)^2), x_Symbol] :> Dist[2*e, Subst[Int[x^2/(c*d^2 + a*e^2 - 2*c*d
*x^2 + c*x^4), x], x, Sqrt[d + e*x]], x] /; FreeQ[{a, c, d, e}, x] && NeQ[c*d^2 + a*e^2, 0]

Rule 1143

Int[(x_)^(m_.)/((a_) + (b_.)*(x_)^2 + (c_.)*(x_)^4), x_Symbol] :> With[{q = Rt[a/c, 2]}, With[{r = Rt[2*q - b/
c, 2]}, Dist[1/(2*c*r), Int[x^(m - 1)/(q - r*x + x^2), x], x] - Dist[1/(2*c*r), Int[x^(m - 1)/(q + r*x + x^2),
 x], x]]] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0] && GeQ[m, 1] && LtQ[m, 3] && NegQ[b^2 - 4*a*c]

Rule 3566

Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Dist[b/d, Subst[Int[(a + x)^n/(b^2 + x^2), x], x
, b*Tan[c + d*x]], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[a^2 + b^2, 0]

Rule 3609

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[d*
((a + b*Tan[e + f*x])^m/(f*m)), x] + Int[(a + b*Tan[e + f*x])^(m - 1)*Simp[a*c - b*d + (b*c + a*d)*Tan[e + f*x
], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && GtQ[m, 0]

Rubi steps \begin{align*} \text {integral}& = -\frac {2 b (a+b \cot (c+d x))^{3/2}}{3 d}+\int \left (-a^2-b^2\right ) \sqrt {a+b \cot (c+d x)} \, dx \\ & = -\frac {2 b (a+b \cot (c+d x))^{3/2}}{3 d}+\left (-a^2-b^2\right ) \int \sqrt {a+b \cot (c+d x)} \, dx \\ & = -\frac {2 b (a+b \cot (c+d x))^{3/2}}{3 d}+\frac {\left (b \left (a^2+b^2\right )\right ) \text {Subst}\left (\int \frac {\sqrt {a+x}}{b^2+x^2} \, dx,x,b \cot (c+d x)\right )}{d} \\ & = -\frac {2 b (a+b \cot (c+d x))^{3/2}}{3 d}+\frac {\left (2 b \left (a^2+b^2\right )\right ) \text {Subst}\left (\int \frac {x^2}{a^2+b^2-2 a x^2+x^4} \, dx,x,\sqrt {a+b \cot (c+d x)}\right )}{d} \\ & = -\frac {2 b (a+b \cot (c+d x))^{3/2}}{3 d}+\frac {\left (b \left (a^2+b^2\right )\right ) \text {Subst}\left (\int \frac {x}{\sqrt {a^2+b^2}-\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} x+x^2} \, dx,x,\sqrt {a+b \cot (c+d x)}\right )}{\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} d}-\frac {\left (b \left (a^2+b^2\right )\right ) \text {Subst}\left (\int \frac {x}{\sqrt {a^2+b^2}+\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} x+x^2} \, dx,x,\sqrt {a+b \cot (c+d x)}\right )}{\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} d} \\ & = -\frac {2 b (a+b \cot (c+d x))^{3/2}}{3 d}+\frac {\left (b \left (a^2+b^2\right )\right ) \text {Subst}\left (\int \frac {1}{\sqrt {a^2+b^2}-\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} x+x^2} \, dx,x,\sqrt {a+b \cot (c+d x)}\right )}{2 d}+\frac {\left (b \left (a^2+b^2\right )\right ) \text {Subst}\left (\int \frac {1}{\sqrt {a^2+b^2}+\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} x+x^2} \, dx,x,\sqrt {a+b \cot (c+d x)}\right )}{2 d}+\frac {\left (b \left (a^2+b^2\right )\right ) \text {Subst}\left (\int \frac {-\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}}+2 x}{\sqrt {a^2+b^2}-\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} x+x^2} \, dx,x,\sqrt {a+b \cot (c+d x)}\right )}{2 \sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} d}-\frac {\left (b \left (a^2+b^2\right )\right ) \text {Subst}\left (\int \frac {\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}}+2 x}{\sqrt {a^2+b^2}+\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} x+x^2} \, dx,x,\sqrt {a+b \cot (c+d x)}\right )}{2 \sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} d} \\ & = -\frac {2 b (a+b \cot (c+d x))^{3/2}}{3 d}+\frac {b \left (a^2+b^2\right ) \log \left (a+\sqrt {a^2+b^2}+b \cot (c+d x)-\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} \sqrt {a+b \cot (c+d x)}\right )}{2 \sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} d}-\frac {b \left (a^2+b^2\right ) \log \left (a+\sqrt {a^2+b^2}+b \cot (c+d x)+\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} \sqrt {a+b \cot (c+d x)}\right )}{2 \sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} d}-\frac {\left (b \left (a^2+b^2\right )\right ) \text {Subst}\left (\int \frac {1}{2 \left (a-\sqrt {a^2+b^2}\right )-x^2} \, dx,x,-\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}}+2 \sqrt {a+b \cot (c+d x)}\right )}{d}-\frac {\left (b \left (a^2+b^2\right )\right ) \text {Subst}\left (\int \frac {1}{2 \left (a-\sqrt {a^2+b^2}\right )-x^2} \, dx,x,\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}}+2 \sqrt {a+b \cot (c+d x)}\right )}{d} \\ & = \frac {b \left (a^2+b^2\right ) \text {arctanh}\left (\frac {\sqrt {a+\sqrt {a^2+b^2}}-\sqrt {2} \sqrt {a+b \cot (c+d x)}}{\sqrt {a-\sqrt {a^2+b^2}}}\right )}{\sqrt {2} \sqrt {a-\sqrt {a^2+b^2}} d}-\frac {b \left (a^2+b^2\right ) \text {arctanh}\left (\frac {\sqrt {a+\sqrt {a^2+b^2}}+\sqrt {2} \sqrt {a+b \cot (c+d x)}}{\sqrt {a-\sqrt {a^2+b^2}}}\right )}{\sqrt {2} \sqrt {a-\sqrt {a^2+b^2}} d}-\frac {2 b (a+b \cot (c+d x))^{3/2}}{3 d}+\frac {b \left (a^2+b^2\right ) \log \left (a+\sqrt {a^2+b^2}+b \cot (c+d x)-\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} \sqrt {a+b \cot (c+d x)}\right )}{2 \sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} d}-\frac {b \left (a^2+b^2\right ) \log \left (a+\sqrt {a^2+b^2}+b \cot (c+d x)+\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} \sqrt {a+b \cot (c+d x)}\right )}{2 \sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} d} \\ \end{align*}

Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 6.62 (sec) , antiderivative size = 178, normalized size of antiderivative = 0.44 \[ \int (-a+b \cot (c+d x)) (a+b \cot (c+d x))^{3/2} \, dx=\frac {(-a+b \cot (c+d x)) (a+b \cot (c+d x)) \left (3 i \sqrt {a-i b} \left (a^2+b^2\right ) \text {arctanh}\left (\frac {\sqrt {a+b \cot (c+d x)}}{\sqrt {a-i b}}\right )-3 i \sqrt {a+i b} \left (a^2+b^2\right ) \text {arctanh}\left (\frac {\sqrt {a+b \cot (c+d x)}}{\sqrt {a+i b}}\right )+2 b (a+b \cot (c+d x))^{3/2}\right ) \sin ^2(c+d x)}{-3 b^2 d \cos ^2(c+d x)+3 a^2 d \sin ^2(c+d x)} \]

[In]

Integrate[(-a + b*Cot[c + d*x])*(a + b*Cot[c + d*x])^(3/2),x]

[Out]

((-a + b*Cot[c + d*x])*(a + b*Cot[c + d*x])*((3*I)*Sqrt[a - I*b]*(a^2 + b^2)*ArcTanh[Sqrt[a + b*Cot[c + d*x]]/
Sqrt[a - I*b]] - (3*I)*Sqrt[a + I*b]*(a^2 + b^2)*ArcTanh[Sqrt[a + b*Cot[c + d*x]]/Sqrt[a + I*b]] + 2*b*(a + b*
Cot[c + d*x])^(3/2))*Sin[c + d*x]^2)/(-3*b^2*d*Cos[c + d*x]^2 + 3*a^2*d*Sin[c + d*x]^2)

Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(985\) vs. \(2(333)=666\).

Time = 0.07 (sec) , antiderivative size = 986, normalized size of antiderivative = 2.42

method result size
derivativedivides \(-\frac {2 b \left (a +b \cot \left (d x +c \right )\right )^{\frac {3}{2}}}{3 d}+\frac {\ln \left (\sqrt {a +b \cot \left (d x +c \right )}\, \sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}-b \cot \left (d x +c \right )-\sqrt {a^{2}+b^{2}}-a \right ) \sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}\, \sqrt {a^{2}+b^{2}}\, a^{2}}{4 d b}+\frac {b \ln \left (\sqrt {a +b \cot \left (d x +c \right )}\, \sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}-b \cot \left (d x +c \right )-\sqrt {a^{2}+b^{2}}-a \right ) \sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}\, \sqrt {a^{2}+b^{2}}}{4 d}-\frac {b \arctan \left (\frac {-2 \sqrt {a +b \cot \left (d x +c \right )}+\sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}}{\sqrt {2 \sqrt {a^{2}+b^{2}}-2 a}}\right ) a^{2}}{d \sqrt {2 \sqrt {a^{2}+b^{2}}-2 a}}-\frac {b^{3} \arctan \left (\frac {-2 \sqrt {a +b \cot \left (d x +c \right )}+\sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}}{\sqrt {2 \sqrt {a^{2}+b^{2}}-2 a}}\right )}{d \sqrt {2 \sqrt {a^{2}+b^{2}}-2 a}}-\frac {\ln \left (\sqrt {a +b \cot \left (d x +c \right )}\, \sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}-b \cot \left (d x +c \right )-\sqrt {a^{2}+b^{2}}-a \right ) \sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}\, a^{3}}{4 d b}-\frac {b \ln \left (\sqrt {a +b \cot \left (d x +c \right )}\, \sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}-b \cot \left (d x +c \right )-\sqrt {a^{2}+b^{2}}-a \right ) \sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}\, a}{4 d}-\frac {\ln \left (b \cot \left (d x +c \right )+a +\sqrt {a +b \cot \left (d x +c \right )}\, \sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}+\sqrt {a^{2}+b^{2}}\right ) \sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}\, \sqrt {a^{2}+b^{2}}\, a^{2}}{4 d b}-\frac {b \ln \left (b \cot \left (d x +c \right )+a +\sqrt {a +b \cot \left (d x +c \right )}\, \sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}+\sqrt {a^{2}+b^{2}}\right ) \sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}\, \sqrt {a^{2}+b^{2}}}{4 d}+\frac {b \arctan \left (\frac {2 \sqrt {a +b \cot \left (d x +c \right )}+\sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}}{\sqrt {2 \sqrt {a^{2}+b^{2}}-2 a}}\right ) a^{2}}{d \sqrt {2 \sqrt {a^{2}+b^{2}}-2 a}}+\frac {b^{3} \arctan \left (\frac {2 \sqrt {a +b \cot \left (d x +c \right )}+\sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}}{\sqrt {2 \sqrt {a^{2}+b^{2}}-2 a}}\right )}{d \sqrt {2 \sqrt {a^{2}+b^{2}}-2 a}}+\frac {\ln \left (b \cot \left (d x +c \right )+a +\sqrt {a +b \cot \left (d x +c \right )}\, \sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}+\sqrt {a^{2}+b^{2}}\right ) \sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}\, a^{3}}{4 d b}+\frac {b \ln \left (b \cot \left (d x +c \right )+a +\sqrt {a +b \cot \left (d x +c \right )}\, \sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}+\sqrt {a^{2}+b^{2}}\right ) \sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}\, a}{4 d}\) \(986\)
default \(-\frac {2 b \left (a +b \cot \left (d x +c \right )\right )^{\frac {3}{2}}}{3 d}+\frac {\ln \left (\sqrt {a +b \cot \left (d x +c \right )}\, \sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}-b \cot \left (d x +c \right )-\sqrt {a^{2}+b^{2}}-a \right ) \sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}\, \sqrt {a^{2}+b^{2}}\, a^{2}}{4 d b}+\frac {b \ln \left (\sqrt {a +b \cot \left (d x +c \right )}\, \sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}-b \cot \left (d x +c \right )-\sqrt {a^{2}+b^{2}}-a \right ) \sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}\, \sqrt {a^{2}+b^{2}}}{4 d}-\frac {b \arctan \left (\frac {-2 \sqrt {a +b \cot \left (d x +c \right )}+\sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}}{\sqrt {2 \sqrt {a^{2}+b^{2}}-2 a}}\right ) a^{2}}{d \sqrt {2 \sqrt {a^{2}+b^{2}}-2 a}}-\frac {b^{3} \arctan \left (\frac {-2 \sqrt {a +b \cot \left (d x +c \right )}+\sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}}{\sqrt {2 \sqrt {a^{2}+b^{2}}-2 a}}\right )}{d \sqrt {2 \sqrt {a^{2}+b^{2}}-2 a}}-\frac {\ln \left (\sqrt {a +b \cot \left (d x +c \right )}\, \sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}-b \cot \left (d x +c \right )-\sqrt {a^{2}+b^{2}}-a \right ) \sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}\, a^{3}}{4 d b}-\frac {b \ln \left (\sqrt {a +b \cot \left (d x +c \right )}\, \sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}-b \cot \left (d x +c \right )-\sqrt {a^{2}+b^{2}}-a \right ) \sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}\, a}{4 d}-\frac {\ln \left (b \cot \left (d x +c \right )+a +\sqrt {a +b \cot \left (d x +c \right )}\, \sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}+\sqrt {a^{2}+b^{2}}\right ) \sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}\, \sqrt {a^{2}+b^{2}}\, a^{2}}{4 d b}-\frac {b \ln \left (b \cot \left (d x +c \right )+a +\sqrt {a +b \cot \left (d x +c \right )}\, \sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}+\sqrt {a^{2}+b^{2}}\right ) \sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}\, \sqrt {a^{2}+b^{2}}}{4 d}+\frac {b \arctan \left (\frac {2 \sqrt {a +b \cot \left (d x +c \right )}+\sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}}{\sqrt {2 \sqrt {a^{2}+b^{2}}-2 a}}\right ) a^{2}}{d \sqrt {2 \sqrt {a^{2}+b^{2}}-2 a}}+\frac {b^{3} \arctan \left (\frac {2 \sqrt {a +b \cot \left (d x +c \right )}+\sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}}{\sqrt {2 \sqrt {a^{2}+b^{2}}-2 a}}\right )}{d \sqrt {2 \sqrt {a^{2}+b^{2}}-2 a}}+\frac {\ln \left (b \cot \left (d x +c \right )+a +\sqrt {a +b \cot \left (d x +c \right )}\, \sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}+\sqrt {a^{2}+b^{2}}\right ) \sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}\, a^{3}}{4 d b}+\frac {b \ln \left (b \cot \left (d x +c \right )+a +\sqrt {a +b \cot \left (d x +c \right )}\, \sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}+\sqrt {a^{2}+b^{2}}\right ) \sqrt {2 \sqrt {a^{2}+b^{2}}+2 a}\, a}{4 d}\) \(986\)
parts \(\text {Expression too large to display}\) \(1656\)

[In]

int((-a+b*cot(d*x+c))*(a+b*cot(d*x+c))^(3/2),x,method=_RETURNVERBOSE)

[Out]

-2/3*b*(a+b*cot(d*x+c))^(3/2)/d+1/4/d/b*ln((a+b*cot(d*x+c))^(1/2)*(2*(a^2+b^2)^(1/2)+2*a)^(1/2)-b*cot(d*x+c)-(
a^2+b^2)^(1/2)-a)*(2*(a^2+b^2)^(1/2)+2*a)^(1/2)*(a^2+b^2)^(1/2)*a^2+1/4/d*b*ln((a+b*cot(d*x+c))^(1/2)*(2*(a^2+
b^2)^(1/2)+2*a)^(1/2)-b*cot(d*x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/2)*arctan((2*(
a+b*cot(d*x+c))^(1/2)+(2*(a^2+b^2)^(1/2)+2*a)^(1/2))/(2*(a^2+b^2)^(1/2)-2*a)^(1/2))+1/4/d/b*ln(b*cot(d*x+c)+a+
(a+b*cot(d*x+c))^(1/2)*(2*(a^2+b^2)^(1/2)+2*a)^(1/2)+(a^2+b^2)^(1/2))*(2*(a^2+b^2)^(1/2)+2*a)^(1/2)*a^3+1/4/d*
b*ln(b*cot(d*x+c)+a+(a+b*cot(d*x+c))^(1/2)*(2*(a^2+b^2)^(1/2)+2*a)^(1/2)+(a^2+b^2)^(1/2))*(2*(a^2+b^2)^(1/2)+2
*a)^(1/2)*a

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 1148 vs. \(2 (335) = 670\).

Time = 0.29 (sec) , antiderivative size = 1148, normalized size of antiderivative = 2.81 \[ \int (-a+b \cot (c+d x)) (a+b \cot (c+d x))^{3/2} \, dx=\text {Too large to display} \]

[In]

integrate((-a+b*cot(d*x+c))*(a+b*cot(d*x+c))^(3/2),x, algorithm="fricas")

[Out]

-1/6*(3*d*sqrt(-(a^5 + 2*a^3*b^2 + a*b^4 + d^2*sqrt(-(a^8*b^2 + 4*a^6*b^4 + 6*a^4*b^6 + 4*a^2*b^8 + b^10)/d^4)
)/d^2)*log(d^3*sqrt(-(a^5 + 2*a^3*b^2 + a*b^4 + d^2*sqrt(-(a^8*b^2 + 4*a^6*b^4 + 6*a^4*b^6 + 4*a^2*b^8 + b^10)
/d^4))/d^2)*sqrt(-(a^8*b^2 + 4*a^6*b^4 + 6*a^4*b^6 + 4*a^2*b^8 + b^10)/d^4) + (a^6*b + 3*a^4*b^3 + 3*a^2*b^5 +
 b^7)*sqrt((b*cos(2*d*x + 2*c) + a*sin(2*d*x + 2*c) + b)/sin(2*d*x + 2*c)))*sin(2*d*x + 2*c) - 3*d*sqrt(-(a^5
+ 2*a^3*b^2 + a*b^4 + d^2*sqrt(-(a^8*b^2 + 4*a^6*b^4 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^7)*sqrt((b*cos(2*d*x + 2*c) + a*sin(2*d*x + 2*c) + b)/sin(
2*d*x + 2*c)))*sin(2*d*x + 2*c) + 4*(b^2*cos(2*d*x + 2*c) + a*b*sin(2*d*x + 2*c) + b^2)*sqrt((b*cos(2*d*x + 2*
c) + a*sin(2*d*x + 2*c) + b)/sin(2*d*x + 2*c)))/(d*sin(2*d*x + 2*c))

Sympy [F]

\[ \int (-a+b \cot (c+d x)) (a+b \cot (c+d x))^{3/2} \, dx=- \int a^{2} \sqrt {a + b \cot {\left (c + d x \right )}}\, dx - \int \left (- b^{2} \sqrt {a + b \cot {\left (c + d x \right )}} \cot ^{2}{\left (c + d x \right )}\right )\, dx \]

[In]

integrate((-a+b*cot(d*x+c))*(a+b*cot(d*x+c))**(3/2),x)

[Out]

-Integral(a**2*sqrt(a + b*cot(c + d*x)), x) - Integral(-b**2*sqrt(a + b*cot(c + d*x))*cot(c + d*x)**2, x)

Maxima [F]

\[ \int (-a+b \cot (c+d x)) (a+b \cot (c+d x))^{3/2} \, dx=\int { {\left (b \cot \left (d x + c\right ) + a\right )}^{\frac {3}{2}} {\left (b \cot \left (d x + c\right ) - a\right )} \,d x } \]

[In]

integrate((-a+b*cot(d*x+c))*(a+b*cot(d*x+c))^(3/2),x, algorithm="maxima")

[Out]

integrate((b*cot(d*x + c) + a)^(3/2)*(b*cot(d*x + c) - a), x)

Giac [F]

\[ \int (-a+b \cot (c+d x)) (a+b \cot (c+d x))^{3/2} \, dx=\int { {\left (b \cot \left (d x + c\right ) + a\right )}^{\frac {3}{2}} {\left (b \cot \left (d x + c\right ) - a\right )} \,d x } \]

[In]

integrate((-a+b*cot(d*x+c))*(a+b*cot(d*x+c))^(3/2),x, algorithm="giac")

[Out]

integrate((b*cot(d*x + c) + a)^(3/2)*(b*cot(d*x + c) - a), x)

Mupad [B] (verification not implemented)

Time = 25.17 (sec) , antiderivative size = 2529, normalized size of antiderivative = 6.20 \[ \int (-a+b \cot (c+d x)) (a+b \cot (c+d x))^{3/2} \, dx=\text {Too large to display} \]

[In]

int(-(a + b*cot(c + d*x))^(3/2)*(a - b*cot(c + d*x)),x)

[Out]

log((((16*b^4*(a + b*cot(c + d*x))^(1/2)*(a^4 + b^4 - 6*a^2*b^2))/d^2 - (16*a*b^2*(((-b^6*d^4*(3*a^2 - b^2)^2)
^(1/2) - 3*a*b^4*d^2 + a^3*b^2*d^2)/d^4)^(1/2)*(a^2*b + b^3 + d*(((-b^6*d^4*(3*a^2 - b^2)^2)^(1/2) - 3*a*b^4*d
^2 + a^3*b^2*d^2)/d^4)^(1/2)*(a + b*cot(c + d*x))^(1/2)))/d)*(((-b^6*d^4*(3*a^2 - b^2)^2)^(1/2) - 3*a*b^4*d^2
+ a^3*b^2*d^2)/d^4)^(1/2))/2 + (8*b^5*(a^2 - b^2)*(a^2 + b^2)^2)/d^3)*((6*a^2*b^8*d^4 - b^10*d^4 - 9*a^4*b^6*d
^4)^(1/2)/(4*d^4) - (3*a*b^4)/(4*d^2) + (a^3*b^2)/(4*d^2))^(1/2) - log((8*b^5*(a^2 - b^2)*(a^2 + b^2)^2)/d^3 -
 (((16*b^4*(a + b*cot(c + d*x))^(1/2)*(a^4 + b^4 - 6*a^2*b^2))/d^2 + (16*a*b^2*(-((-b^6*d^4*(3*a^2 - b^2)^2)^(
1/2) + 3*a*b^4*d^2 - a^3*b^2*d^2)/d^4)^(1/2)*(a^2*b + b^3 - d*(-((-b^6*d^4*(3*a^2 - b^2)^2)^(1/2) + 3*a*b^4*d^
2 - a^3*b^2*d^2)/d^4)^(1/2)*(a + b*cot(c + d*x))^(1/2)))/d)*(-((-b^6*d^4*(3*a^2 - b^2)^2)^(1/2) + 3*a*b^4*d^2
- a^3*b^2*d^2)/d^4)^(1/2))/2)*(-((6*a^2*b^8*d^4 - b^10*d^4 - 9*a^4*b^6*d^4)^(1/2) + 3*a*b^4*d^2 - a^3*b^2*d^2)
/(4*d^4))^(1/2) - log((8*b^5*(a^2 - b^2)*(a^2 + b^2)^2)/d^3 - (((16*b^4*(a + b*cot(c + d*x))^(1/2)*(a^4 + b^4
- 6*a^2*b^2))/d^2 + (16*a*b^2*(((-b^6*d^4*(3*a^2 - b^2)^2)^(1/2) - 3*a*b^4*d^2 + a^3*b^2*d^2)/d^4)^(1/2)*(a^2*
b + b^3 - d*(((-b^6*d^4*(3*a^2 - b^2)^2)^(1/2) - 3*a*b^4*d^2 + a^3*b^2*d^2)/d^4)^(1/2)*(a + b*cot(c + d*x))^(1
/2)))/d)*(((-b^6*d^4*(3*a^2 - b^2)^2)^(1/2) - 3*a*b^4*d^2 + a^3*b^2*d^2)/d^4)^(1/2))/2)*(((6*a^2*b^8*d^4 - b^1
0*d^4 - 9*a^4*b^6*d^4)^(1/2) - 3*a*b^4*d^2 + a^3*b^2*d^2)/(4*d^4))^(1/2) + log((((16*b^4*(a + b*cot(c + d*x))^
(1/2)*(a^4 + b^4 - 6*a^2*b^2))/d^2 - (16*a*b^2*(-((-b^6*d^4*(3*a^2 - b^2)^2)^(1/2) + 3*a*b^4*d^2 - a^3*b^2*d^2
)/d^4)^(1/2)*(a^2*b + b^3 + d*(-((-b^6*d^4*(3*a^2 - b^2)^2)^(1/2) + 3*a*b^4*d^2 - a^3*b^2*d^2)/d^4)^(1/2)*(a +
 b*cot(c + d*x))^(1/2)))/d)*(-((-b^6*d^4*(3*a^2 - b^2)^2)^(1/2) + 3*a*b^4*d^2 - a^3*b^2*d^2)/d^4)^(1/2))/2 + (
8*b^5*(a^2 - b^2)*(a^2 + b^2)^2)/d^3)*((a^3*b^2)/(4*d^2) - (3*a*b^4)/(4*d^2) - (6*a^2*b^8*d^4 - b^10*d^4 - 9*a
^4*b^6*d^4)^(1/2)/(4*d^4))^(1/2) - log(((-((-a^4*b^2*d^4*(3*a^2 - b^2)^2)^(1/2) + a^5*d^2 - 3*a^3*b^2*d^2)/d^4
)^(1/2)*((16*a^2*b^2*(a + b*cot(c + d*x))^(1/2)*(a^4 + b^4 - 6*a^2*b^2))/d^2 + (16*a*b^2*(-((-a^4*b^2*d^4*(3*a
^2 - b^2)^2)^(1/2) + a^5*d^2 - 3*a^3*b^2*d^2)/d^4)^(1/2)*(a^2*b + b^3 + d*(-((-a^4*b^2*d^4*(3*a^2 - b^2)^2)^(1
/2) + a^5*d^2 - 3*a^3*b^2*d^2)/d^4)^(1/2)*(a + b*cot(c + d*x))^(1/2)))/d))/2 - (16*a^4*b^3*(a^2 + b^2)^2)/d^3)
*(-((6*a^6*b^4*d^4 - a^4*b^6*d^4 - 9*a^8*b^2*d^4)^(1/2) + a^5*d^2 - 3*a^3*b^2*d^2)/(4*d^4))^(1/2) - log(((((-a
^4*b^2*d^4*(3*a^2 - b^2)^2)^(1/2) - a^5*d^2 + 3*a^3*b^2*d^2)/d^4)^(1/2)*((16*a^2*b^2*(a + b*cot(c + d*x))^(1/2
)*(a^4 + b^4 - 6*a^2*b^2))/d^2 + (16*a*b^2*(((-a^4*b^2*d^4*(3*a^2 - b^2)^2)^(1/2) - a^5*d^2 + 3*a^3*b^2*d^2)/d
^4)^(1/2)*(a^2*b + b^3 + d*(((-a^4*b^2*d^4*(3*a^2 - b^2)^2)^(1/2) - a^5*d^2 + 3*a^3*b^2*d^2)/d^4)^(1/2)*(a + b
*cot(c + d*x))^(1/2)))/d))/2 - (16*a^4*b^3*(a^2 + b^2)^2)/d^3)*(((6*a^6*b^4*d^4 - a^4*b^6*d^4 - 9*a^8*b^2*d^4)
^(1/2) - a^5*d^2 + 3*a^3*b^2*d^2)/(4*d^4))^(1/2) + log(- ((((-a^4*b^2*d^4*(3*a^2 - b^2)^2)^(1/2) - a^5*d^2 + 3
*a^3*b^2*d^2)/d^4)^(1/2)*((16*a^2*b^2*(a + b*cot(c + d*x))^(1/2)*(a^4 + b^4 - 6*a^2*b^2))/d^2 - (16*a*b^2*(((-
a^4*b^2*d^4*(3*a^2 - b^2)^2)^(1/2) - a^5*d^2 + 3*a^3*b^2*d^2)/d^4)^(1/2)*(a^2*b + b^3 - d*(((-a^4*b^2*d^4*(3*a
^2 - b^2)^2)^(1/2) - a^5*d^2 + 3*a^3*b^2*d^2)/d^4)^(1/2)*(a + b*cot(c + d*x))^(1/2)))/d))/2 - (16*a^4*b^3*(a^2
 + b^2)^2)/d^3)*((6*a^6*b^4*d^4 - a^4*b^6*d^4 - 9*a^8*b^2*d^4)^(1/2)/(4*d^4) - a^5/(4*d^2) + (3*a^3*b^2)/(4*d^
2))^(1/2) + log(- ((-((-a^4*b^2*d^4*(3*a^2 - b^2)^2)^(1/2) + a^5*d^2 - 3*a^3*b^2*d^2)/d^4)^(1/2)*((16*a^2*b^2*
(a + b*cot(c + d*x))^(1/2)*(a^4 + b^4 - 6*a^2*b^2))/d^2 - (16*a*b^2*(-((-a^4*b^2*d^4*(3*a^2 - b^2)^2)^(1/2) +
a^5*d^2 - 3*a^3*b^2*d^2)/d^4)^(1/2)*(a^2*b + b^3 - d*(-((-a^4*b^2*d^4*(3*a^2 - b^2)^2)^(1/2) + a^5*d^2 - 3*a^3
*b^2*d^2)/d^4)^(1/2)*(a + b*cot(c + d*x))^(1/2)))/d))/2 - (16*a^4*b^3*(a^2 + b^2)^2)/d^3)*((3*a^3*b^2)/(4*d^2)
 - a^5/(4*d^2) - (6*a^6*b^4*d^4 - a^4*b^6*d^4 - 9*a^8*b^2*d^4)^(1/2)/(4*d^4))^(1/2) - (2*b*(a + b*cot(c + d*x)
)^(3/2))/(3*d)